package com.pshcp.doctor.api;

import com.framework.base.PageList;
import com.framework.base.ResultBuilder;
import com.framework.base.ResultDTO;
import com.framework.exception.BizException;
import com.framework.logaop.Log;
import com.framework.logaop.LogSourceEnum;
import com.framework.logaop.LogTypeEnum;
import com.pshcp.doctor.ao.diagnosisevaluation.DoctorDiagnosisEvaluationPageAO;
import com.pshcp.doctor.tool.DoctorDiagnosisEvaluationTool;
import com.pshcp.doctor.vo.diagnosisevaluation.DoctorDiagnosisEvaluationVO;
import com.pshcp.domain.dto.DoctorDiagnosisEvaluationDTO;
import com.pshcp.domain.model.DoctorDiagnosisEvaluation;
import com.pshcp.service.DoctorDiagnosisEvaluationService;
import com.pshcp.service.PatientService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author: xiaoche
 * @Date: 2022/11/4 01:11
 */
@Api(tags = {"医生端-诊断评价接口"})
@Slf4j
@RestController
@RequestMapping("/api/doctor/diagnosisEvaluation")
public class DoctorDiagnosisEvaluationAPI {

    @Autowired
    private DoctorDiagnosisEvaluationService doctorDiagnosisEvaluationService;

    @Autowired
    private PatientService patientService;

    @ApiOperation("获取诊断评价列表(分页)")
    @Log(source = LogSourceEnum.APP, type = LogTypeEnum.SELECT, desc = "获取诊断评价列表(分页)")
    @PostMapping("getDoctorDiagnosisEvaluationPage")
    public ResultDTO<PageList<DoctorDiagnosisEvaluationVO>> getDoctorDiagnosisEvaluationPage(@RequestBody DoctorDiagnosisEvaluationPageAO doctorDiagnosisEvaluationPageAO) throws BizException {
        DoctorDiagnosisEvaluationDTO doctorDiagnosisEvaluationDTO = DoctorDiagnosisEvaluationTool.buildGetDoctorSendMessagePage(doctorDiagnosisEvaluationPageAO);
        PageList<DoctorDiagnosisEvaluation> pageList = doctorDiagnosisEvaluationService.list(doctorDiagnosisEvaluationDTO);
        PageList<DoctorDiagnosisEvaluationVO> page = DoctorDiagnosisEvaluationTool.buildGetDoctorDiagnosisEvaluationPage(patientService, pageList);
        return ResultBuilder.success(page);
    }
}
